﻿using System;
using System.Data;
using DAL;
using Ext.Net;

namespace ERP.Modules.Report
{
    public partial class ReportLogImportExport : System.Web.UI.UserControl
    {
        readonly clsConnect Cls = new clsConnect();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                GetData();
            }
        }

        protected void StoreReportLogImportExport_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            GetData();
        }

        void GetData()
        {
            Cls.CreateNewSqlCommand();
            var dtin = Cls.GetData("sp_Get_Log_Inventory");
            Cls.CreateNewSqlCommand();
            var dti = Cls.GetData("sp_Get_Log_Import");
            Cls.CreateNewSqlCommand();
            var dte = Cls.GetData("sp_Get_Log_Export");
            dti.Merge(dtin);
            dte.Merge(dti);
            dte.DefaultView.Sort = "Date ASC";
            StoreReportLogImportExport.DataSource = dte.DefaultView.ToTable();
            StoreReportLogImportExport.DataBind();
        }
    }
}